<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Title</title>
    <meta charset="UTF-8">
    <script src="static/jquery.min.js"></script>
    <script src="static/easyui/jquery.easyui.min.js"></script>
    <link rel="stylesheet" href="static/layui/css/layui.css">
    <link rel="stylesheet" href="static/easyui/themes/default/easyui.css"/>
</head>
<form id="menu-edit-form" style="width: 80%">
    <input type="hidden" name="id" th:value="${menu!=null?menu.id:''}">
    <div class="layui-form-item">
        <label class="layui-form-label">菜单名称</label>
        <div class="layui-input-block">
            <input type="text" name="text" required lay-verify="required" placeholder="请输入菜单名" autocomplete="off"
                   class="layui-input"  th:value="${menu!=null?menu.text:''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">父节点</label>
        <div class="layui-input-block">
            <input class="easyui-combotree" name="parentId" id="parentId"
                   style="width:220px;"  th:value="${menu!=null?menu.parentId:''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">URL</label>
        <div class="layui-input-block">
            <input type="text" name="url" required lay-verify="required" placeholder="请输入url" autocomplete="off"
                   class="layui-input"  th:value="${menu!=null?menu.url:''}">
        </div>
    </div>
</form>
<script type="text/javascript">
    $(function(){
        $.ajax({
            url:'menu.html?act=tree',
            method:'post',
            success:function(data){
//                var newData=new Array();
//                newData[0]={"id":1,"text":"根节点"}
//                for(var i=0;i<data.length;i++){
//                    newData[i+1]=data[i]
//                }
                $("#parentId").combotree('loadData',data)
            }
        })
    })
</script>
</html>